{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from lifelines.datasets import load_rossi\n",
    "rossi = load_rossi()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>week</th>\n",
       "      <th>arrest</th>\n",
       "      <th>fin</th>\n",
       "      <th>age</th>\n",
       "      <th>race</th>\n",
       "      <th>wexp</th>\n",
       "      <th>mar</th>\n",
       "      <th>paro</th>\n",
       "      <th>prio</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>20</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>17</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>18</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>25</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>19</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>52</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>23</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>19</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   week  arrest  fin  age  race  wexp  mar  paro  prio\n",
       "0    20       1    0   27     1     0    0     1     3\n",
       "1    17       1    0   18     1     0    0     1     8\n",
       "2    25       1    0   19     0     1    0     1    13\n",
       "3    52       0    1   23     1     1    1     1     1\n",
       "4    52       0    0   19     0     1    0     1     3"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rossi.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# let's b-spline age\n",
    "cph = CoxPHFitter().fit(rossi, \"week\", \"arrest\", formula=\"fin + bs(age, df=4) + wexp + mar + paro + prio\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>week</th>\n",
       "      <th>arrest</th>\n",
       "      <th>fin</th>\n",
       "      <th>age</th>\n",
       "      <th>race</th>\n",
       "      <th>wexp</th>\n",
       "      <th>mar</th>\n",
       "      <th>paro</th>\n",
       "      <th>prio</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>17.000000</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>17.551020</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>18.102041</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>18.653061</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>19.204082</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   week  arrest  fin        age  race  wexp  mar  paro  prio\n",
       "0  52.0     0.0  0.5  17.000000   1.0   1.0  0.0   1.0   2.0\n",
       "1  52.0     0.0  0.5  17.551020   1.0   1.0  0.0   1.0   2.0\n",
       "2  52.0     0.0  0.5  18.102041   1.0   1.0  0.0   1.0   2.0\n",
       "3  52.0     0.0  0.5  18.653061   1.0   1.0  0.0   1.0   2.0\n",
       "4  52.0     0.0  0.5  19.204082   1.0   1.0  0.0   1.0   2.0"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# now we need to \"extend\" our data to plot it\n",
    "# we'll plot age over it's observed range\n",
    "age_range = np.linspace(rossi['age'].min(), rossi['age'].max(), 50)\n",
    "\n",
    "# need to create a matrix of variables at their means, _except_ for age. \n",
    "x_bar = cph._central_values\n",
    "df_varying_age = pd.concat([x_bar] * 50).reset_index(drop=True)\n",
    "df_varying_age['age'] = age_range\n",
    "\n",
    "df_varying_age.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CAYAAADhNOGaAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAloUlEQVR4nO3deXxU9b3/8dcnCUlIgCQkIWEJJAiyyCoRXHABl+JS0YoWqtVWre1t6Xq7eOv93fZ621uX22p7a1tx12oRtVZaF4q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O224E33L0v8EZ4OtrUAv/q7gOBM4Fvhf+No33bq4Gx7j4UGAaMM7MziZ3xPr5L6K4Fh8TKdo9x92H1rh046e95zAQBRxkXIeCamoW7vwNUNGgeT2jMB4jSsR/cfbO7fxR+XUnoj0N3onzbPWRPeLJd+OHEwHgfZtYDuBx4ODwdy+OcnPT3PJaC4GjjIsSKHHffHH69BcgJspjmZmb5wHDgA2Jg28OHRxYCZcBMYC0nMN5HG3Y/8GPgYHj6hMY5acMc+KeZzTez28JtJ/091+D1Mcjd3cyi9rxhM+sAvAB8z913h34khkTrtrt7HTDMzNKBF4H+wVbU/MzsCqDM3eeb2QUBl9PSRrt7qZl1AWaa2Yr6M0/0ex5LewRHGxchVmw1s64A4eeygOtpFmbWjlAIPO3ufw03x8S2A7j7TkK3dz+L8Hgf4VnR+H0/B7jSzNYTOtQ7Fvgt0b/duHtp+LmMUPCPJILveSwFQaPjIgRcU0uaTmjMB4jSsR/Cx4cfAZa7+2/qzYrqbTez7PCeAGbWHriYUP9IVI/34e7/5u493D2f0P/nN939eqJ8u80s1cw6HnoNXAIsJYLveUxdWWxmlxE6phgPPOruvwy2ouZhZn8BLiB0W9qtwM+AvwHTgJ6EbuF9nbs37FBu08xsNPAusIT/O2b8U0L9BFG77WY2hFDnYDyhH3fT3P1OM+tN6JdyZ2ABcIO7VwdXafMJHxr6obtfEe3bHd6+F8OTCcAz7v5LM8vkJL/nMRUEIiJypFg6NCQiIo1QEIiIxDgFgYhIjFMQiIjEOAWBiEiMUxCIiMQ4BYGISIz7/8dGLAQBW+rjAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "cph.predict_log_partial_hazard(df_varying_age).plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy86wFpkAAAACXBIWXMAAAsTAAALEwEAmpwYAAAlwUlEQVR4nO3dd3xUZdr/8c+VRuhSQm8iRQMIyNAhsSSAiIDYsKIrYkNKHtfVdfdRd91V18cAIoqABSsqoqCgQFg3oUNCkS5FkU4UARGk5f79kXF/qEHKTHImM9/36zWvOeXO3NfR4cvhTM415pxDRETCX5TXBYiISNFQ4IuIRAgFvohIhFDgi4hECAW+iEiEiPG6gN9TuXJlV69ePa/LEBEpNnJycr51ziUUtC+kA79evXpkZ2d7XYaISLFhZptPtk+XdEREIoQCX0QkQijwRUQihAJfRCRCKPBFRCKEAl9EJEIo8EVEIkRYBv5zs9azfMter8sQEQkpYRf4+w4e5e2F33DVC3P557Q1HDpy3OuSRERCQtgFfvlSscxIS+L61nUYk7WJbiOymL/xO6/LEhHxXNgFPkC5+Fie7NOMt+9sC8ANYxfw8KQV7P/pqMeViYh4JywD/2cdzqvMZ4OTGJBUn3cXf0OX9CxmrdnldVkiIp4I68AHKBkXzZ+7X8CH93akfMlY7hifzaB3lvLdgcNelyYiUqTCPvB/1rz2OXx8fyeGpjTi05U7SB2WxeRl29CXuItIpIiYwAeIi4licEpDpg7qTJ2KpRg8YRn9x2ezY98hr0sTESl0ERX4P2tUtSwf3NOBv1xxAXM3fkuX9CzeXvgNeXk62xeR8BWRgQ8QHWX071yfGUOSaVarPH/+cAU3jlvA19/+6HVpIiKFImID/2d1KpXirf5teapPM1Zt20+3EVmMzdrEcZ3ti0iYCUrgm1k3M1tnZhvM7KEC9qeZ2Woz+8LMZplZ3WDMGyxmRt82dZiZlkynBgn8Y9oa+rwwl3U7f/C6NBGRoAk48M0sGhgFXA4kAje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BbrFlZp2A2cAK/v813T+Tfx0/bI8bwMwuJP9DumjyT9bec879zczqk3/2WxFYCtzsnDvsXaWFw39J5wHnXI9IOGb/MX7oX40B3nbO/cPMKnGW7/WwC3wRESlYuF3SERGRk1Dgi4hECAW+iEiEUOCLiEQIBb6ISIRQ4IuIRAgFvohIhPh/G4lwFGfcNrAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# compare to _not_ bspline-ing:\n",
    "cph = CoxPHFitter().fit(rossi, \"week\", \"arrest\", formula=\"fin + age + wexp + mar + paro + prio\")\n",
    "\n",
    "age_range = np.linspace(rossi['age'].min(), rossi['age'].max(), 50)\n",
    "\n",
    "# need to create a matrix of variables at their means, _except_ for age. \n",
    "x_bar = cph._central_values\n",
    "df_varying_age = pd.concat([x_bar] * 50).reset_index(drop=True)\n",
    "df_varying_age['age'] = age_range\n",
    "\n",
    "cph.predict_log_partial_hazard(df_varying_age).plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
